import{getUserInfo, setUserInfo, removeUserInfo} from "@/utils/storage.js"
let user =  {
	namespaced: true,
	state:{
		userInfo:getUserInfo()
	},
	mutations:{
		setUser(state, payload){
			console.log(111)
			state.userInfo = payload
			setUserInfo(payload)
		},
		removeUser(state,  payload){
			state.userInfo = {}
			removeUserInfo()
		}
	},
	actions:{
		async login(context, data){
			 let  ret = await uni.$u.post('WxUser/Login', data);
			 context.commit('setUser',ret)
		}
	}
	
}
export default user